<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../../vue.js"></script>
  <style>
    ul li {
      display: inline-block;
      width: 20px;
      height: 20px;
    }

    .active {
      background: blue;
      color: white;
    }

    .active a {
      color: white;
    }
  </style>
</head>

<body>
  <div id="app">

    <table>
      <tr>
        <td>职位名称</td>
        <td>薪水</td>
      </tr>
      <tr v-for="o in dataview.list">
        <td>{{o.positionName}}</td>
        <td>{{o.salary}}</td>
      </tr>
    </table>

    <div class="box-footer clearfix">
      <ul class="pagination pagination-sm no-margin pull-right">
        <li><a :href="'#/position?pageno=1&pagesize='+pagesize+'&keywords='+keywords">«</a></li>


        <li v-for="n in pages" @click="curentindex=n" :class="curentindex==n? 'active':''"><a
            v-bind:href="'#/position?pageno='+ n +'&pagesize='+ pagesize +'&keywords='+keywords ">{{n}}</a></li>

        <li><a :href="'#/position?pageno='+pages+'&pagesize='+pagesize+'&keywords='+keywords">»</a></li>
      </ul>
    </div>


  </div>

</body>
<script>



  var vm = new Vue({
    el: '#app',
    data: {
      curentindex: 1,
      pagesize: 5,
      keywords: 'key',
      dataview: {
        list: [
          { id: 1, positionName: 'java', salary: '20k' },
          { id: 2, positionName: 'fe', salary: '30k' }
        ],
        total: 31
      }
    },
    computed: {
      pages() {
        return Math.ceil(this.dataview.total / this.pagesize);
      }
    }
  })



</script>

</html>